home *** CD-ROM | disk | FTP | other *** search
- /*
- * Copyright (C) 1992, 1994, Silicon Graphics, Inc.
- * All Rights Reserved.
- *
- * This is UNPUBLISHED PROPRIETARY SOURCE CODE of Silicon Graphics, Inc.;
- * the contents of this file may not be disclosed to third parties, copied or
- * duplicated in any form, in whole or in part, without the prior written
- * permission of Silicon Graphics, Inc.
- *
- * RESTRICTED RIGHTS LEGEND:
- * Use, duplication or disclosure by the Government is subject to restrictions
- * as set forth in subdivision (c)(1)(ii) of the Rights in Technical Data
- * and Computer Software clause at DFARS 252.227-7013, and/or in similar or
- * successor clauses in the FAR, DOD or NASA FAR Supplement. Unpublished -
- * rights reserved under the Copyright Laws of the United States.
- */
- #ifndef OKARGS_H
- #define OKARGS_H
-
- //
- // OkArgs.h
- //
- // See Class Definition.
- //
-
- //
- // $Revision: 1.2 $
- //
- // OkArgs.h - a C++ facility for build Widget argument lists for XtSetValues.
- // The main advantages of using OkArgs over other coding
- // conventions for creating argument lists is that:
- //
- // o Argument counting is done automagically
- //
- // o You get assertion checking of the number of
- // arguments stuffed into the ArgList.
- //
-
- #include <Xm/Xm.h>
-
- #include <assert.h>
-
- class OkArgs {
- ArgList _args;
- Cardinal _count;
- Cardinal _max;
-
- public:
- OkArgs(Cardinal max)
- { _args = new Arg[max]; _max = max; _count = 0; }
-
- ~OkArgs() { delete _args; }
-
- void set(String name, void* value)
- {
- assert(_count < _max);
- XtSetArg(_args[_count], name, value);
- _count++;
- }
-
- void set(String name, int value)
- {
- assert(_count < _max);
- XtSetArg(_args[_count], name, value);
- _count++;
- }
-
- void reset()
- { _count = 0; }
-
- ArgList list()
- { return _args; }
-
- Cardinal count()
- { return _count; }
- };
-
- #endif
-